package com.zax.listener;

import com.zax.model.Type;
import com.zax.service.TypeService;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.List;

@WebListener()
public class ApplicationListener implements ServletContextListener {
    private TypeService tService = new TypeService();
    @Override
    public void contextInitialized(ServletContextEvent arg0) {
        List<Type> list = tService.selectAll();
        arg0.getServletContext().setAttribute("typeList" , list);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
